<?php 
class academic_Form_FrmAcademic extends Zend_Form
{
	public function FrmAcademic($frm = null){
		$db = new Application_Model_DbTable_DbGlobal();
		$db_branch = $db->getGlobalDb("SELECT `branch_id`,`branch_name` FROM `tbwu_branch` WHERE `branch_id` !=''");
		$options_branch = array(''=>'--- ជ្រើសរើសប្រភេទសាខា ---');
		foreach($db_branch as $read_branch) $options_branch[$read_branch['branch_id']]= $read_branch['branch_name'];
		$branch_name = new Zend_Form_Element_Select('branch_name');
		$branch_name->setMultiOptions($options_branch);
		$branch_name->setAttribs(array('id'=>'branch_name',	'class'=>'form-control chzn-select validate[required]',));
		
		$status = new Zend_Form_Element_Select('status');
		$status->setAttribs(array('class'=>'form-control validate[required]'));
		$opt_status = array(''=>'--- ជ្រើសរើស ស្ថានភាព ---','1'=>'ប្រើប្រាស់','0'=>'មិនប្រើប្រាស់');
		$status->setMultiOptions($opt_status);
		$status->setValue(1);
		$years = new Zend_Form_Element_Text("academic_year");
		$years->setAttribs(array('class'=>'form-control validate[required]','placeholder'=>' Example : 2015  -  2016',"onclick"=>"Getacademic()"));
		
		$this->addElements(array($branch_name,$status,$years));
		if($frm !=""){
			$branch_name->setValue($frm['branch_id']);
			$years->setValue($frm['academic_year']);
			$status->setValue($frm['status']);
		}
		return $this;
	}
}
?>
